package com.cos.openapi.web.controller;

import com.cos.openapi.entity.Menu;
import com.cos.openapi.pojo.JsonResult;
import com.cos.openapi.pojo.TableResult;
import com.cos.openapi.services.MenuServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: COS
 * @time: 2021/2/2 14:09
 * @description:
 */
@RestController
@RequestMapping("/sys/menu")
public class MennuController {
    @Autowired
    private MenuServices menuServices;


    @RequestMapping("/list")
    public TableResult getList(){
        return menuServices.getList();
    }

    @RequestMapping("/info")
    public Menu getInfo(Integer id){
        return menuServices.getInfo(id);
    }

    @RequestMapping("/tree")
    public List<Menu> getTree(){
        return menuServices.getTree();
    }
    @RequestMapping("/add")
    public JsonResult add(Menu menu){
        return menuServices.addMenu(menu);
    }
    @RequestMapping("/update")
    public JsonResult update(Menu menu){
        return menuServices.updateMenu(menu);
    }

}
